Optimal. Leaf size=78 \[ \frac {1}{6} b x^2 \cos \left (a+\frac {b}{x}\right )+\frac {1}{6} b^3 \cos (a) \text {Ci}\left (\frac {b}{x}\right )-\frac {1}{6} b^2 x \sin \left (a+\frac {b}{x}\right )+\frac {1}{3} x^3 \sin \left (a+\frac {b}{x}\right )-\frac {1}{6} b^3 \sin (a) \text {Si}\left (\frac {b}{x}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 78, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.417, Rules used = {3460, 3378,
3384, 3380, 3383} \begin {gather*} \frac {1}{6} b^3 \cos (a) \text {CosIntegral}\left (\frac {b}{x}\right )-\frac {1}{6} b^3 \sin (a) \text {Si}\left (\frac {b}{x}\right )-\frac {1}{6} b^2 x \sin \left (a+\frac {b}{x}\right )+\frac {1}{3} x^3 \sin \left (a+\frac {b}{x}\right )+\frac {1}{6} b x^2 \cos \left (a+\frac {b}{x}\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3378
Rule 3380
Rule 3383
Rule 3384
Rule 3460
Rubi steps
\begin {align*} \int x^2 \sin \left (a+\frac {b}{x}\right ) \, dx &=-\text {Subst}\left (\int \frac {\sin (a+b x)}{x^4} \, dx,x,\frac {1}{x}\right )\\ &=\frac {1}{3} x^3 \sin \left (a+\frac {b}{x}\right )-\frac {1}{3} b \text {Subst}\left (\int \frac {\cos (a+b x)}{x^3} \, dx,x,\frac {1}{x}\right )\\ &=\frac {1}{6} b x^2 \cos \left (a+\frac {b}{x}\right )+\frac {1}{3} x^3 \sin \left (a+\frac {b}{x}\right )+\frac {1}{6} b^2 \text {Subst}\left (\int \frac {\sin (a+b x)}{x^2} \, dx,x,\frac {1}{x}\right )\\ &=\frac {1}{6} b x^2 \cos \left (a+\frac {b}{x}\right )-\frac {1}{6} b^2 x \sin \left (a+\frac {b}{x}\right )+\frac {1}{3} x^3 \sin \left (a+\frac {b}{x}\right )+\frac {1}{6} b^3 \text {Subst}\left (\int \frac {\cos (a+b x)}{x} \, dx,x,\frac {1}{x}\right )\\ &=\frac {1}{6} b x^2 \cos \left (a+\frac {b}{x}\right )-\frac {1}{6} b^2 x \sin \left (a+\frac {b}{x}\right )+\frac {1}{3} x^3 \sin \left (a+\frac {b}{x}\right )+\frac {1}{6} \left (b^3 \cos (a)\right ) \text {Subst}\left (\int \frac {\cos (b x)}{x} \, dx,x,\frac {1}{x}\right )-\frac {1}{6} \left (b^3 \sin (a)\right ) \text {Subst}\left (\int \frac {\sin (b x)}{x} \, dx,x,\frac {1}{x}\right )\\ &=\frac {1}{6} b x^2 \cos \left (a+\frac {b}{x}\right )+\frac {1}{6} b^3 \cos (a) \text {Ci}\left (\frac {b}{x}\right )-\frac {1}{6} b^2 x \sin \left (a+\frac {b}{x}\right )+\frac {1}{3} x^3 \sin \left (a+\frac {b}{x}\right )-\frac {1}{6} b^3 \sin (a) \text {Si}\left (\frac {b}{x}\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.05, size = 70, normalized size = 0.90 \begin {gather*} \frac {1}{6} \left (b^3 \cos (a) \text {Ci}\left (\frac {b}{x}\right )+x \left (b x \cos \left (a+\frac {b}{x}\right )-b^2 \sin \left (a+\frac {b}{x}\right )+2 x^2 \sin \left (a+\frac {b}{x}\right )\right )-b^3 \sin (a) \text {Si}\left (\frac {b}{x}\right )\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.09, size = 73, normalized size = 0.94
method | result | size |
derivativedivides | \(-b^{3} \left (-\frac {\sin \left (a +\frac {b}{x}\right ) x^{3}}{3 b^{3}}-\frac {\cos \left (a +\frac {b}{x}\right ) x^{2}}{6 b^{2}}+\frac {\sin \left (a +\frac {b}{x}\right ) x}{6 b}+\frac {\sinIntegral \left (\frac {b}{x}\right ) \sin \left (a \right )}{6}-\frac {\cosineIntegral \left (\frac {b}{x}\right ) \cos \left (a \right )}{6}\right )\) | \(73\) |
default | \(-b^{3} \left (-\frac {\sin \left (a +\frac {b}{x}\right ) x^{3}}{3 b^{3}}-\frac {\cos \left (a +\frac {b}{x}\right ) x^{2}}{6 b^{2}}+\frac {\sin \left (a +\frac {b}{x}\right ) x}{6 b}+\frac {\sinIntegral \left (\frac {b}{x}\right ) \sin \left (a \right )}{6}-\frac {\cosineIntegral \left (\frac {b}{x}\right ) \cos \left (a \right )}{6}\right )\) | \(73\) |
risch | \(\frac {i \pi \,\mathrm {csgn}\left (\frac {b}{x}\right ) {\mathrm e}^{-i a} b^{3}}{12}-\frac {i \sinIntegral \left (\frac {b}{x}\right ) {\mathrm e}^{-i a} b^{3}}{6}-\frac {\expIntegral \left (1, -\frac {i b}{x}\right ) {\mathrm e}^{-i a} b^{3}}{12}-\frac {b^{3} \expIntegral \left (1, -\frac {i b}{x}\right ) {\mathrm e}^{i a}}{12}+\frac {x^{2} b \cos \left (\frac {a x +b}{x}\right )}{6}-\frac {\sin \left (\frac {a x +b}{x}\right ) b^{2} x}{6}+\frac {\sin \left (\frac {a x +b}{x}\right ) x^{3}}{3}\) | \(122\) |
meijerg | \(-\frac {b^{3} \sqrt {\pi }\, \cos \left (a \right ) \left (-\frac {8 x^{2}}{\sqrt {\pi }\, b^{2}}-\frac {4 \left (2 \gamma -\frac {11}{3}-2 \ln \left (x \right )+2 \ln \left (b \right )\right )}{3 \sqrt {\pi }}+\frac {8 x^{2} \left (-\frac {55 b^{2}}{2 x^{2}}+45\right )}{45 \sqrt {\pi }\, b^{2}}+\frac {8 \gamma }{3 \sqrt {\pi }}+\frac {8 \ln \left (2\right )}{3 \sqrt {\pi }}+\frac {8 \ln \left (\frac {b}{2 x}\right )}{3 \sqrt {\pi }}-\frac {8 x^{2} \cos \left (\frac {b}{x}\right )}{3 \sqrt {\pi }\, b^{2}}-\frac {16 x^{3} \left (-\frac {5 b^{2}}{2 x^{2}}+5\right ) \sin \left (\frac {b}{x}\right )}{15 \sqrt {\pi }\, b^{3}}-\frac {8 \cosineIntegral \left (\frac {b}{x}\right )}{3 \sqrt {\pi }}\right )}{16}-\frac {b^{2} \sqrt {\pi }\, \sin \left (a \right ) \sqrt {b^{2}}\, \left (-\frac {8 \left (-\frac {b^{2}}{x^{2}}+2\right ) x^{3} b^{2} \cos \left (\frac {\sqrt {b^{2}}}{x}\right )}{3 \left (b^{2}\right )^{\frac {5}{2}} \sqrt {\pi }}+\frac {8 x^{2} \sin \left (\frac {\sqrt {b^{2}}}{x}\right )}{3 b^{2} \sqrt {\pi }}+\frac {8 \sinIntegral \left (\frac {\sqrt {b^{2}}}{x}\right )}{3 \sqrt {\pi }}\right )}{16}\) | \(231\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [C] Result contains complex when optimal does not.
time = 0.36, size = 86, normalized size = 1.10 \begin {gather*} \frac {1}{12} \, {\left ({\left ({\rm Ei}\left (\frac {i \, b}{x}\right ) + {\rm Ei}\left (-\frac {i \, b}{x}\right )\right )} \cos \left (a\right ) + {\left (i \, {\rm Ei}\left (\frac {i \, b}{x}\right ) - i \, {\rm Ei}\left (-\frac {i \, b}{x}\right )\right )} \sin \left (a\right )\right )} b^{3} + \frac {1}{6} \, b x^{2} \cos \left (\frac {a x + b}{x}\right ) - \frac {1}{6} \, {\left (b^{2} x - 2 \, x^{3}\right )} \sin \left (\frac {a x + b}{x}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 79, normalized size = 1.01 \begin {gather*} -\frac {1}{6} \, b^{3} \sin \left (a\right ) \operatorname {Si}\left (\frac {b}{x}\right ) + \frac {1}{6} \, b x^{2} \cos \left (\frac {a x + b}{x}\right ) + \frac {1}{12} \, {\left (b^{3} \operatorname {Ci}\left (\frac {b}{x}\right ) + b^{3} \operatorname {Ci}\left (-\frac {b}{x}\right )\right )} \cos \left (a\right ) - \frac {1}{6} \, {\left (b^{2} x - 2 \, x^{3}\right )} \sin \left (\frac {a x + b}{x}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int x^{2} \sin {\left (a + \frac {b}{x} \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 400 vs.
\(2 (68) = 136\).
time = 6.68, size = 400, normalized size = 5.13 \begin {gather*} \frac {a^{3} b^{4} \cos \left (a\right ) \operatorname {Ci}\left (-a + \frac {a x + b}{x}\right ) + a^{3} b^{4} \sin \left (a\right ) \operatorname {Si}\left (a - \frac {a x + b}{x}\right ) - \frac {3 \, {\left (a x + b\right )} a^{2} b^{4} \cos \left (a\right ) \operatorname {Ci}\left (-a + \frac {a x + b}{x}\right )}{x} - \frac {3 \, {\left (a x + b\right )} a^{2} b^{4} \sin \left (a\right ) \operatorname {Si}\left (a - \frac {a x + b}{x}\right )}{x} + \frac {3 \, {\left (a x + b\right )}^{2} a b^{4} \cos \left (a\right ) \operatorname {Ci}\left (-a + \frac {a x + b}{x}\right )}{x^{2}} + a^{2} b^{4} \sin \left (\frac {a x + b}{x}\right ) + \frac {3 \, {\left (a x + b\right )}^{2} a b^{4} \sin \left (a\right ) \operatorname {Si}\left (a - \frac {a x + b}{x}\right )}{x^{2}} + a b^{4} \cos \left (\frac {a x + b}{x}\right ) - \frac {{\left (a x + b\right )}^{3} b^{4} \cos \left (a\right ) \operatorname {Ci}\left (-a + \frac {a x + b}{x}\right )}{x^{3}} - \frac {2 \, {\left (a x + b\right )} a b^{4} \sin \left (\frac {a x + b}{x}\right )}{x} - \frac {{\left (a x + b\right )}^{3} b^{4} \sin \left (a\right ) \operatorname {Si}\left (a - \frac {a x + b}{x}\right )}{x^{3}} - \frac {{\left (a x + b\right )} b^{4} \cos \left (\frac {a x + b}{x}\right )}{x} - 2 \, b^{4} \sin \left (\frac {a x + b}{x}\right ) + \frac {{\left (a x + b\right )}^{2} b^{4} \sin \left (\frac {a x + b}{x}\right )}{x^{2}}}{6 \, {\left (a^{3} - \frac {3 \, {\left (a x + b\right )} a^{2}}{x} + \frac {3 \, {\left (a x + b\right )}^{2} a}{x^{2}} - \frac {{\left (a x + b\right )}^{3}}{x^{3}}\right )} b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int x^2\,\sin \left (a+\frac {b}{x}\right ) \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________